package com.sneakxy.cloudbase.platform.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.sneakxy.cloudbase.platform.bean.FtpConfig;
import com.sneakxy.cloudbase.platform.utils.FtpClientFactory;
import com.sneakxy.cloudbase.platform.utils.fastdfs.FastDfsClient;

@Configuration
public class StorageConfig {

	@Bean
	@ConfigurationProperties(prefix="fastdfs")
	public FastDfsClient fastDfsClient() {
		return new FastDfsClient();
	}
	
	@Bean
	@ConfigurationProperties(prefix="ftp")
	public FtpConfig ftpConfig() {
		return new FtpConfig();
	}
	
	@Bean
	public FtpClientFactory ftpClientFactory() {
		return new FtpClientFactory(ftpConfig());
	}
	
}
